#include <stdio.h>

struct Student {
  int num;
  float score;
  struct Student *next;
};

int main(int argc, char *argv[])
{
  // 建立链表结构
  struct Student a = {10101, 89.5, NULL};
  struct Student b = {10103, 90, NULL};
  struct Student c = {10107, 85, NULL};
  struct Student d = {10109, 99, NULL};
  struct Student e = {10111, 85, NULL};
  struct Student *head = NULL;
  head = &a;
  a.next = &b;
  b.next = &e;
  c.next = &d;
  d.next = NULL;
  e.next = &c;
  // 通过循环语句遍历链表
  struct Student *p = head;
  while (p != NULL)
  { // 当没有遇到链表尾时
    printf("log: We are visiting node %p\n", p);
    // 打印每一位学生的成绩
    printf("ID=%d, score=%.2f\n", p->num, p->score);
    // 继续遍历下一个结点
    p = p->next;
  }
  return 0;
}